home *** CD-ROM | disk | FTP | other *** search
- (*************************************************************************
-
- $RCSfile: LowLevel.mod $
- Description: Interface to lowlevel.library
-
- Created by: fjc (Frank Copeland)
- $Revision: 3.7 $
- $Author: fjc $
- $Date: 1995/06/04 23:13:14 $
-
- Includes Release 40.15
-
- (C) Copyright 1993 Commodore-Amiga, Inc.
- All Rights Reserved
-
- Oberon-A Interface Copyright © 1994-1995, Frank Copeland.
- This file is part of the Oberon-A Interface.
- See Oberon-A.doc for conditions of use and distribution.
-
- *************************************************************************)
-
- <* STANDARD- *>
-
- MODULE [2] LowLevel;
-
- IMPORT
- SYS := SYSTEM, Kernel, e := Exec, u := Utility, t := Timer, s := Sets;
-
- (*
- ** $VER: lowlevel.h 40.6 (30.7.93)
- **
- ** lowlevel.library interface structures and definitions.
- *)
-
- (*****************************************************************************)
-
- TYPE
-
- (* structure for use with QueryKeys() *)
- KeyQueryPtr * = POINTER TO KeyQuery;
- KeyQuery * = RECORD
- keyCode * : e.UWORD;
- pressed * : e.BOOL;
- END;
-
-
- (*****************************************************************************)
-
- CONST
-
- (* bits in the return value of GetKey() *)
- lShift * = 16;
- rShift * = 17;
- capsLock * = 18;
- control * = 19;
- lAlt * = 20;
- rAlt * = 21;
- lAmiga * = 22;
- rAmiga * = 23;
-
-
- (*****************************************************************************)
-
- CONST
-
- (* Tags for SetJoyPortAttrs() *)
- sjaDummy * = u.user + 0C00100H;
- sjaType * = sjaDummy+1; (* force type to mouse, joy, game cntrlr *)
- sjaReinitialize * = sjaDummy+2; (* free potgo bits, reset to autosense *)
-
- (* Controller types for sjaType tag *)
- sjaTypeAutoSense * = 0;
- sjaTypeGameCtlr * = 1;
- sjaTypeMouse * = 2;
- sjaTypeJoystk * = 3;
-
-
- (*****************************************************************************)
-
- CONST
-
- (* ReadJoyPort() return value definitions *)
-
- (* Port types *)
- typeNotAvail * = 0; (* port data unavailable *)
- typeGameCtlr * = 010000000H; (* port has game controller *)
- typeMouse * = 020000000H; (* port has mouse *)
- typeJoyStk * = 030000000H; (* port has joystick *)
- typeUnknown * = 040000000H; (* port has unknown device *)
- typeMask * = 0F0000000H; (* controller type *)
-
- (* Button types, valid for all types except JP_TYPE_NOTAVAIL *)
- buttonBlue * = 23; (* Blue - Stop; Right Mouse *)
- buttonRed * = 22; (* Red - Select; Left Mouse; Joystick Fire *)
- buttonYellow * = 21; (* Yellow - Repeat *)
- buttonGreen * = 20; (* Green - Shuffle *)
- buttonForward * = 19; (* Charcoal - Forward *)
- buttonReverse * = 18; (* Charcoal - Reverse *)
- buttonPlay * = 17; (* Grey - Play/Pause; Middle Mouse *)
- buttonMask * = { buttonBlue, buttonRed, buttonYellow,
- buttonGreen, buttonForward, buttonReverse,
- buttonPlay };
-
- (* Direction types, valid for jpTypeGamectlr and jpTypeJoystk *)
- joyUp * = 3;
- joyDown * = 2;
- joyLeft * = 1;
- joyRight * = 0;
- directionMask * = {joyUp, joyDown, joyLeft, joyRight};
-
- (* Mouse position reports, valid for jpTypeMouse *)
- mHorzMask * = 0FFH; (* horzizontal position *)
- mVertMask * = 0FF00H; (* vertical position *)
- mouseMask * = mHorzMask + mVertMask;
-
- (* Obsolete ReadJoyPort() definitions, here for source code compatibility only.
- * Please do NOT use in new code.
- *)
- btn1 * = buttonBlue;
- btn2 * = buttonRed;
- btn3 * = buttonYellow;
- btn4 * = buttonGreen;
- btn5 * = buttonForward;
- btn6 * = buttonReverse;
- btn7 * = buttonPlay;
- up * = joyUp;
- down * = joyDown;
- left * = joyLeft;
- right * = joyRight;
-
-
- (*****************************************************************************)
-
- CONST
-
- (* Tags for SystemControl() *)
- sconDummy * = u.user + 000C00000H;
- sconTakeOverSys * = sconDummy+0;
- sconKillReq * = sconDummy+1;
- sconCDReboot * = sconDummy+2;
- sconStopInput * = sconDummy+3;
- sconAddCreateKeys * = sconDummy+4;
- sconRemCreateKeys * = sconDummy+5;
-
- (* Reboot control values for use with SCON_CDReboot tag *)
- cdRebootOn * = 1;
- cdRebootOff * = 0;
- cdRebootDefault * = 2;
-
-
- (*****************************************************************************)
-
- CONST
-
- (* Rawkey codes returned when using sconAddCreateKeys with SystemControl() *)
-
- port0ButtonBlue * = 072H;
- port0ButtonRed * = 078H;
- port0ButtonYellow * = 077H;
- port0ButtonGreen * = 076H;
- port0ButtonForward * = 075H;
- port0ButtonReverse * = 074H;
- port0ButtonPlay * = 073H;
- port0JoyUp * = 079H;
- port0JoyDown * = 07AH;
- port0JoyLeft * = 07CH;
- port0JoyRight * = 07BH;
-
- port1ButtonBlue * = 0172H;
- port1ButtonRed * = 0178H;
- port1ButtonYellow * = 0177H;
- port1ButtonGreen * = 0176H;
- port1ButtonForward * = 0175H;
- port1ButtonReverse * = 0174H;
- port1ButtonPlay * = 0173H;
- port1JoyUp * = 0179H;
- port1JoyDown * = 017AH;
- port1JoyLeft * = 017CH;
- port1JoyRight * = 017BH;
-
- port2ButtonBlue * = 0272H;
- port2ButtonRed * = 0278H;
- port2ButtonYellow * = 0277H;
- port2ButtonGreen * = 0276H;
- port2ButtonForward * = 0275H;
- port2ButtonReverse * = 0274H;
- port2ButtonPlay * = 0273H;
- port2JoyUp * = 0279H;
- port2JoyDown * = 027AH;
- port2JoyLeft * = 027CH;
- port2JoyRight * = 027BH;
-
- port3ButtonBlue * = 0372H;
- port3ButtonRed * = 0378H;
- port3ButtonYellow * = 0377H;
- port3ButtonGreen * = 0376H;
- port3ButtonForward * = 0375H;
- port3ButtonReverse * = 0374H;
- port3ButtonPlay * = 0373H;
- port3JoyUp * = 0379H;
- port3JoyDown * = 037AH;
- port3JoyLeft * = 037CH;
- port3JoyRight * = 037BH;
-
-
- (*****************************************************************************)
-
- CONST
-
- (* Return values for GetLanguageSelection() *)
- langUnknown * = 0;
- american * = 1; (* American English *)
- english * = 2; (* British English *)
- german * = 3;
- french * = 4;
- spanish * = 5;
- italian * = 6;
- portuguese * = 7;
- danish * = 8;
- dutch * = 9;
- norwegian * = 10;
- finnish * = 11;
- swedish * = 12;
- japanese * = 13;
- chinese * = 14;
- arabic * = 15;
- greek * = 16;
- hebrew * = 17;
- korean * = 18;
-
-
- (*****************************************************************************)
-
- (*-- Library Base variable --------------------------------------------*)
-
- CONST
-
- lowlevelName * = "lowlevel.library";
-
- VAR
-
- base* : e.LibraryPtr;
-
-
- (*-- Library Functions ------------------------------------------------*)
-
- TYPE
- (* some dummys for type security *)
- KBIntHandle * = POINTER TO RECORD END;
- TimerIntHandle * = POINTER TO RECORD END;
- VBlankIntHandle * = POINTER TO RECORD END;
-
- (* easy handling of GetKey() result *)
- KeyDescription * = RECORD
- qualifier *: s.SET16;
- code *: INTEGER;
- END;
-
- (*
- ** $VER: lowlevel_protos.h 40.6 (30.7.93)
- *)
-
- (*--- functions in V40 or higher (Release 3.1) ---*)
-
- (* CONTROLLER HANDLING *)
-
- PROCEDURE ReadJoyPort* [base,-30]
- ( port [0] : e.ULONG )
- : s.SET32;
-
- (* LANGUAGE HANDLING *)
-
- PROCEDURE GetLanguageSelection* [base,-36] ()
- : SHORTINT;
-
- (* KEYBOARD HANDLING *)
-
- PROCEDURE GetKey* [base,-48] ()
- : e.ULONG;
- PROCEDURE QueryKeys* [base,-54]
- ( queryArray [8] : KeyQueryPtr;
- arraySize [1] : e.ULONG );
- PROCEDURE AddKBInt* [base,-60]
- ( intRoutine [8] : e.PROC;
- intData [9] : e.APTR )
- : KBIntHandle;
- PROCEDURE RemKBInt* [base,-66]
- ( intHandle [9] : KBIntHandle );
-
- (* SYSTEM HANDLING *)
-
- PROCEDURE SystemControlA* [base,-72]
- ( tagList [9] : ARRAY OF u.TagItem )
- : u.TagID;
- PROCEDURE SystemControl* [base,-72]
- ( tagList [9]..: u.Tag )
- : u.TagID;
-
- (* TIMER HANDLING *)
-
- PROCEDURE AddTimerInt* [base,-78]
- ( intRoutine [8] : e.PROC;
- intData [9] : e.APTR )
- : TimerIntHandle;
- PROCEDURE RemTimerInt* [base,-84]
- ( intHandle [9] : TimerIntHandle );
- PROCEDURE StopTimerInt* [base,-90]
- ( intHandle [9] : TimerIntHandle );
- PROCEDURE StartTimerInt* [base,-96]
- ( intHandle [9] : TimerIntHandle;
- timeInterval [0] : e.ULONG;
- continuous [1] : e.LONGBOOL );
- PROCEDURE ElapsedTime* [base,-102]
- ( VAR context [8] : t.EClockVal )
- : e.ULONG;
-
- (* VBLANK HANDLING *)
-
- PROCEDURE AddVBlankInt* [base,-108]
- ( intRoutine [8] : e.PROC;
- intData [9] : e.APTR )
- : VBlankIntHandle;
- PROCEDURE RemVBlankInt* [base,-114]
- ( intHandle [9] : VBlankIntHandle );
-
- (* MORE CONTROLLER HANDLING *)
-
- PROCEDURE SetJoyPortAttrsA* [base,-132]
- ( portNumber [0] : e.ULONG;
- tagList [9] : ARRAY OF u.TagItem )
- : BOOLEAN;
- PROCEDURE SetJoyPortAttrs* [base,-132]
- ( portNumber [0] : e.ULONG;
- tagList [9]..: u.Tag )
- : BOOLEAN;
-
- (* only a dummy to make sure SIZE(KeyDescriptor) = SIZE(LONGINT) *)
- PROCEDURE [0] CheckKeyDescriptorSize(kd: KeyDescription): LONGINT;
- BEGIN
- RETURN SYS.VAL(LONGINT,kd);
- END CheckKeyDescriptorSize;
-
- (*-- Library Base variable --------------------------------------------*)
-
- (*-----------------------------------*)
- PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
-
- BEGIN (* CloseLib *)
- IF base # NIL THEN e.CloseLibrary (base) END
- END CloseLib;
-
- BEGIN
- base := e.OpenLibrary (lowlevelName, e.libraryMinimum);
- IF base # NIL THEN Kernel.SetCleanup (CloseLib) END
- END LowLevel.
-